Revamp documentation building, deployment and cleanup#292
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 🚀 New features to boost your workflow:
|
…gs and main. Also clean up docs related to PRs when the PR is closed.
a5535aa to
f247c78
Compare
|
I think I would rather have another repo for the built documentation (unless this is not doable). Otherwise, the size of TorchJD/torchjd will grow uncontrollably, which will slow down clones and hence possibly other actions. The alternative would be to use This seems related: peaceiris/actions-gh-pages#35 |
When I suggested Python 3.13.1 instead of 3.12.3 in `CONTRIBUTING.md` (4ed413e), I should have also changed the python version of build_deploy_documentation.yml to 3.13, but I forgot. The reason is that I think it's better to use the latest Python version whenever we can, whether it be for users, contributors or even github actions. Since this PR will also end up with the removal of build_deploy_documentation.yml, I think it's a good time to also update Python to 3.13 in the new build-deploy-docs.yml file.
- As suggested in peaceiris/actions-gh-pages#36
- This is to match the name of the secret that I just created in the settings of TorchJD/torchjd
|
I followed the steps indicated in https://github.com/peaceiris/actions-gh-pages?tab=readme-ov-file#%EF%B8%8F-deploy-to-external-repository-external_repository. Basically, we now specify the target repository (TorchJD/documentation), and we need to prove our right to push to this repository. I then followed ChatGPT's advice to setup the required ssh keys. To do that, I created an ssh key pair on my computer. I then added the public key as a IT WORKS!!! I think I will delete the private key from my computer and store it in my personal bitwarden (not in this order), but we should try to have a shared bitwarden at some point @PierreQuinton |
|
As far as I understand, it would also be fine to just delete the private key from my computer, so that only torchjd has them. If we ever need them, we can always generate new ones. |
|
The documentation of TorchJD/documentation can be visited at https://torchjd.github.io/documentation/ |
|
It would be really nice to be able to simply click on the "Build and Deploy Documentation / build (pull_request)" action (from the drop down list of actions that ran on the PR) and to be redirected directly to the right folder of the built and deployed documentation. EDIT: I managed to have a suboptimal solution for this. I added a last step named "Add documentation link to summary". When it's run, it will create a summary for the action, containing the link. So to visit the built documentation, we will have to click on the check status of the documentation build / deployment, then click on "Summary", then click on the link "📄 View Deployed Documentation". Without creating a Github App, I don't think it's possible to do really better than this. We could alternatively add a comment to the PR, but I don't really like this as it will create a lot of noise. So I think the solution of the Summary link is good enough for now. |
|
Very cool, I think this is ready to merge right? We could then test it with other Prs, test the cleanup, with push to mains and finally newtag. Then the documentqtion could go to torchjd.org |
|
I just fixed the cleanup-pr-docs.yml action to also write to the TorchJD/documentation repo, and to use the same ssh key (DOCUMENTATION_DEPLOY_KEY) to be allowed to write to it. I also removed gh-pages from the path, since I think we don't use that anymore (the pr/ folder is right at the root of the repo now). Since it's hard to test this, I added a workflow_dispatch trigger to be able to manually run this action. We can remove it when we know that it works. |
|
Closing and reopening the PR successfully launched the clean up action, which succeeded to push its commit to TorchJD/documentation main. |
TODO after merging: